﻿using System;
using Enyim.Caching;
using Ayatta.Contract;
using Web.My.Models;
using System.Web.Mvc;
using Web.Core.Security;
using Web.Core.Extensions;

namespace Web.My.Controllers
{
    public class IntegralController : BaseController
    {
        public IntegralController(Lazy<IInfrastructureService> infrastructure, Lazy<IPassportService> passport, Lazy<IAccountService> account, Lazy<IStoreService> store, Lazy<ITradeService> trade, Lazy<IPlayService> play, Lazy<IMiscService> misc, Lazy<IExtraService> extra, IMemcachedClient memcachedClient)
            : base(infrastructure, passport, account, store, trade, play, misc, extra, memcachedClient)
        {
        }

        /// <summary>
        /// 积分
        /// </summary>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <param name="flow"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        public ActionResult Index(int page = 1, int size = 20, bool? flow = null, int? group = null)
        {
            var identity = User.Identity.Identity();
            var model = new IntegralControllerModel.Index();
            var pointDetails = Account.Value.AccountDetailIntegralPagedList(page, size, identity.Id, flow, group);
            model.Integrals = pointDetails.ToPagedList(page, size);
            return View(model);
        }

        /// <summary>
        /// 积分兑换
        /// </summary>
        /// <returns></returns>
        public ActionResult Exchange()
        {
            return View();
        }

    }
}
